package org.fsconnector.spi;

import java.io.File;

import javax.resource.spi.ConnectionRequestInfo;

public class FSConnectionRequestInfo implements ConnectionRequestInfo {

	private File rootDir;

	public FSConnectionRequestInfo() {
		this(null);
	}

	public FSConnectionRequestInfo(File rootDir) {
		setRootDir(rootDir);
	}

	public File getRootDir() {
		return rootDir;
	}

	public void setRootDir(File rootDir) {
		this.rootDir = rootDir == null ? new File("/") : rootDir;
	}

	@Override
	public boolean equals(Object obj) {
		if(!(obj instanceof FSConnectionRequestInfo)) return false;
		FSConnectionRequestInfo other = (FSConnectionRequestInfo)obj;
		return rootDir.equals(other.rootDir);
	}

	@Override
	public int hashCode() {
		return rootDir.hashCode();
	}

	@Override
	public String toString() {
		return new StringBuilder().append('[').append(rootDir).append(']').toString();
	}

}
